<?php
include('top.php');
require_once('pasmy/dbwaarden.php');
/*echo "dbhost = $dbhost<br>";*/
echo "<br><br>";
$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);
if(isset($_POST["reken"])) {
	//postwaarden();
	$mijnkm = explode("-",$_POST["km"]);
	
	if($_POST["pal"] != "-----") {$a1 = "pal"; $a2 = $_POST["pal"];} else {$a1 = "lm"; $a2 = $_POST["vloer"];}
	$sql = "select prijs from kmprijs where $a1 = $a2 and min = $mijnkm[0] and max = $mijnkm[1]";
	//echo "sql = $sql<br>";
	$res = mysql_query($sql, $mysql_id);
		while ($row = mysql_fetch_row($res)) {
			echo "<div style='text-align: center'><h2>$vraagprijs[$taal]</h2><font size='6' color='#FF0000'>$pprijs[$taal] =  $row[0]</font></div>";
		}
	
}
else {
$kilometers = array("-----","1-50","51-120","121-200","201-280","281-350");
$metervloer = array("-----","0.80","1.00","1.20","1.50","1.60","2.00","2.40","2.50","2.80","3.00","3.20","3.50","3.60","4.00","4.40","4.50","4.80","5.00","5.20","5.50","5.60","6.00","6.40","6.50","6.80","7.00",
"7.20","7.50","7.60","8.00","8.50");
$paletjes = array("-----","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21");
?>
<h2><div style="text-align: center"><?php echo $rekenprijs[$taal];?></div></h2>
<table width="20%" align="center" border="1" cellpadding="5">
<form action="prijs.php" method="post">
<tr>
<td><strong>Km</strong></td><td><select name="km">
<?php
while(list($key, $val)=each($kilometers)) {
	 
		echo '<option value="'.$val.'">'.$val.'</option>';
}
?></select></td>
</tr>
<tr>
<td><strong>Pal</strong></td><td><select name="pal">
<?php
while(list($key, $val)=each($paletjes)) {
	 
		echo '<option value="'.$val.'">'.$val.'</option>';
}
?></select></td>
</tr>
<tr>
<td><strong>Mp</strong></td><td><select name="vloer">
<?php
while(list($key, $val)=each($metervloer)) {
	 
		echo '<option value="'.$val.'">'.$val.'</option>';
}
?></select></td>
</tr>
<tr><td colspan="2"><div style="text-align: center"><input type="submit" name="reken" value="Berekenen" /></div></td></tr>
</form>
</table>


<?php
}
include('footer.php');
?>